package com.ccys.netty;

import com.ccys.netty.config.NettyHttpServer;
import com.ccys.netty.config.NettyServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

import javax.annotation.Resource;

/**
 * Netty启动
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class NettyApplication implements CommandLineRunner {

    @Resource
    private NettyServer nettyServer;

    @Resource
    private NettyHttpServer nettyHttpServer;

    public static void main(String[] args) {
        SpringApplication.run(NettyApplication.class, args);

    }

    @Override
    public void run(String... args) {
        try {
            nettyHttpServer.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
